1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module shumate.Scale; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.AccessibleIF; 30 private import gtk.AccessibleT; 31 private import gtk.BuildableIF; 32 private import gtk.BuildableT; 33 private import gtk.ConstraintTargetIF; 34 private import gtk.ConstraintTargetT; 35 private import gtk.Widget; 36 private import shumate.Viewport; 37 private import shumate.c.functions; 38 public import shumate.c.types; 39 40 41 /** 42 * A widget displaying a scale. 43 * 44 * # CSS nodes 45 * 46 * ``` 47 * map-scale 48 * ├── label[.metric][.imperial] 49 * ``` 50 * 51 * `ShumateScale` uses a single CSS node with name map-scale, it has up to two 52 * childs different labels. 53 */ 54 public class Scale : Widget 55 { 56 /** the main Gtk struct */ 57 protected ShumateScale* shumateScale; 58 59 /** Get the main Gtk struct */ 60 public ShumateScale* getScaleStruct(bool transferOwnership = false) 61 { 62 if (transferOwnership) 63 ownedRef = false; 64 return shumateScale; 65 } 66 67 /** the main Gtk struct as a void* */ 68 protected override void* getStruct() 69 { 70 return cast(void*)shumateScale; 71 } 72 73 /** 74 * Sets our main struct and passes it to the parent class. 75 */ 76 public this (ShumateScale* shumateScale, bool ownedRef = false) 77 { 78 this.shumateScale = shumateScale; 79 super(cast(GtkWidget*)shumateScale, ownedRef); 80 } 81 82 83 /** */ 84 public static GType getType() 85 { 86 return shumate_scale_get_type(); 87 } 88 89 /** 90 * Creates an instance of #ShumateScale. 91 * 92 * Params: 93 * viewport = a #ShumateViewport 94 * 95 * Returns: a new #ShumateScale. 96 * 97 * Throws: ConstructionException GTK+ fails to create the object. 98 */ 99 public this(Viewport viewport) 100 { 101 auto __p = shumate_scale_new((viewport is null) ? null : viewport.getViewportStruct()); 102 103 if(__p is null) 104 { 105 throw new ConstructionException("null returned by new"); 106 } 107 108 this(cast(ShumateScale*) __p); 109 } 110 111 /** 112 * Gets the maximum scale width. 113 * 114 * Returns: The maximum scale width in pixels. 115 */ 116 public uint getMaxWidth() 117 { 118 return shumate_scale_get_max_width(shumateScale); 119 } 120 121 /** 122 * Gets the unit used by the scale. 123 * 124 * Returns: The unit used by the scale 125 */ 126 public ShumateUnit getUnit() 127 { 128 return shumate_scale_get_unit(shumateScale); 129 } 130 131 /** 132 * Gets the viewport used by the scale. 133 * 134 * Returns: The #ShumateViewport used by the scale 135 */ 136 public Viewport getViewport() 137 { 138 auto __p = shumate_scale_get_viewport(shumateScale); 139 140 if(__p is null) 141 { 142 return null; 143 } 144 145 return ObjectG.getDObject!(Viewport)(cast(ShumateViewport*) __p); 146 } 147 148 /** 149 * Sets the maximum width of the scale on the screen in pixels 150 * 151 * Params: 152 * value = the number of pixels 153 */ 154 public void setMaxWidth(uint value) 155 { 156 shumate_scale_set_max_width(shumateScale, value); 157 } 158 159 /** 160 * Sets the scale unit. 161 * 162 * Params: 163 * unit = a #ShumateUnit 164 */ 165 public void setUnit(ShumateUnit unit) 166 { 167 shumate_scale_set_unit(shumateScale, unit); 168 } 169 170 /** 171 * Sets the scale viewport. 172 * 173 * Params: 174 * viewport = a #ShumateViewport 175 */ 176 public void setViewport(Viewport viewport) 177 { 178 shumate_scale_set_viewport(shumateScale, (viewport is null) ? null : viewport.getViewportStruct()); 179 } 180 }